<h1>Assign Attributes to Product <?php echo $model->name; ?></h1>
<?php
$this->widget('Shop.components.multiselect.jUISelectList', array(
    'name' => 'groups[]',
    'data' => $groups,
    'selected' => $selected,
    'type' => 'transfer',
    // additional javascript options for the MultiSelect plugin
    'htmlOptions' => array('style' => 'width:800px;height:400px;margin-bottom:20px','class'=>'groups')
));
$js = <<<EOP
var progress = 0;
$('.assign-groups').click(function(){
    if (progress) return false;
    progress = 1;
    $(this).text('Loading...');
    var that=this,groups = $('.groups').val();
    $.post($(this).attr('href'),{
        SID:'Shop.Product.linkGroups',
        id:$model->id,
        groups:groups
    },function(){
        $(that).text('Save');
        alert('Assign Groups to Product Successful.');
        progress = 0;
    });
    return false;
});
EOP;

cs()->registerScript(__CLASS__.'AssignGroups', $js);
?>
<a style="color: white" href="<?php echo $this->createUrl('/Xpress/service/ajax');?>" role="button" class="btn assign-groups btn-primary">Save</a>